package org.jeecg.modules.flowable.enums;

import lombok.Getter;

/**
 * 任务事项操作类型
 */
@Getter
public enum TaskOperationTypeEnum {

    TERMINATION(-20, "终止"),
    REVOKE(-10, "审批不通过"),
    BACK(-5, "回退"),
    TO_EDIT(-1, "编辑"),
    ACTIVATE(0, "提交"),
    APPROVE(10, "审批"),
    ;

    final Integer code;

    final String desc;

    TaskOperationTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }


    public static TaskOperationTypeEnum formCode(Integer code) {
        if (null == code) {
            return APPROVE;
        }
        for (TaskOperationTypeEnum type : TaskOperationTypeEnum.values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }

        return APPROVE;
    }

}
